package com.app.android;

import java.util.List;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ZoomControls;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class UserLocation extends MapActivity {
	
	LinearLayout linearLayout;
	MapView mapView;
	ZoomControls mZoom;
	
	MapController mapController;
	
	List<Overlay> mapOverlays;
	Drawable drawable;
	UserItemizedOverlay itemizedOverlay;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        /*// capture linearLayout and MapView
        linearLayout = (LinearLayout) findViewById(R.id.zoomview);
        mapView = (MapView) findViewById(R.id.mapview);
        mZoom = (ZoomControls) mapView.getZoomControls();*/
        
        mapView = (MapView) findViewById(R.id.mapview);
		mapView.setBuiltInZoomControls(true);
		mapController = mapView.getController();
		
		// Configure the map display options
		mapView.setSatellite(true);
	//	mapView.setStreetView(true);
		mapController.setZoom(17);
		GeoPoint point = new GeoPoint(35774832, -78685050);
		mapController.setCenter(point);

		// to overlay the droid image  on the map
		mapOverlays = mapView.getOverlays();
		drawable = this.getResources().getDrawable(R.drawable.androidmarker);
		itemizedOverlay = new UserItemizedOverlay(this, mapController, drawable);

		OverlayItem overlayitem = new OverlayItem(point, "Hello", "Hey!");
		
		//to get dynamic location coordinates
		UserLocationOverlay userLocationOverlay = new UserLocationOverlay(this);
		
		itemizedOverlay.addOverlay(overlayitem);
		mapOverlays.add(itemizedOverlay);
		mapOverlays.add(userLocationOverlay);
        
        // add ZoomControls to the linear layout
      //  linearLayout.addView(mZoom);        
      
    }

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}
}